// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   publicSetup_register_ok.java

package hr.config.file;

import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.sql.ResultSet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class publicSetup_register_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;

	public publicSetup_register_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			java.io.PrintWriter out = response.getWriter();
			nseer_db_backup1 hr_db = new nseer_db_backup1(dbApplication);
			if (hr_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String kind = request.getParameter("kind");
				String type_name = request.getParameter("type_name");
				String sqll = (new StringBuilder("select * from hr_config_public_char where kind='")).append(kind).append("' and type_name='").append(type_name).append("'").toString();
				ResultSet rs = hr_db.executeQuery(sqll);
				if (rs.next())
				{
					response.sendRedirect("hr/config/file/publicSetup_register_ok_a.jsp");
				} else
				{
					String sql = (new StringBuilder("insert into hr_config_public_char(kind,type_name) values('")).append(kind).append("','").append(type_name).append("')").toString();
					hr_db.executeUpdate(sql);
					response.sendRedirect("hr/config/file/publicSetup_register_ok_b.jsp");
				}
				hr_db.commit();
				hr_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception exception) { }
	}
}
